/**
 * 首页
 * Created by KY on 2017/4/17.
 */
define(['ldfw/core','comps/ajax','art','text!tpl/index.tpl','jweixin'],
    function (LDFW,ajax,art,tpl,wx) {
        let IndexView = LDFW.Container.extend({
            tpl:tpl,
            className:'panel',
            events:{
                'click [name="accept"]':'accept',
                'click [name="abandon"]':'abandon',
                'change #accept-auth':'toggle'
            },
            initialize:function(){
                this.model.set('co_no',co_no)
                this.model.set('current_company_name',current_company)
            },
            accept:function(){
                let _this = this
                ajax.post('addMarkInfo.do',{mark_type:8}).success(function(){
                    LDFW.navigate('login')
                })
            },
            toggle:function(event){
                if(event.target.checked){
                    $('a[name="accept"]').removeClass('weui-btn_disabled').removeAttr('disabled')
                }else{
                    $('a[name="accept"]').addClass('weui-btn_disabled').attr('disabled',true)
                }
            },
            abandon:function(){

                wx.closeWindow()
            }
        })
        return new IndexView()
    }
)
